package thread;

import java.util.Scanner;

public class Demo7 {
    public  static volatile int a = 0;

    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
            while (a==0){

            }
            System.out.println("t1停止");
        });
        t1.start();
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入");
        a = scanner.nextInt();
        t1.join();
        System.out.println("Main结束");
    }
}
